package com.chuyi.demo.frame;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;

import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.WindowConstants;

import com.chuyi.demo.util.WindowUtilities;

public class JInternalFrames extends JFrame{

	public JInternalFrames() {
	    super("Multiple Document Interface");
	    WindowUtilities.setNativeLookAndFeel();
	  //  addWindowListener(new ExitListener());
	    Container content = getContentPane();
	    content.setBackground(Color.white);
	    JDesktopPane desktop = new JDesktopPane();
	    desktop.setBackground(Color.white);
	    content.add(desktop, BorderLayout.CENTER);
	    setSize(450, 400);
	    for(int i=0; i<5; i++) {
	      JInternalFrame frame
	        = new JInternalFrame(("Internal Frame " + i),
	                             true, true, true, true);
	      frame.setLocation(i*50+10, i*50+10);
	      frame.setSize(200, 150);
	      frame.setBackground(Color.black);
	      desktop.add(frame);
	      frame.moveToFront();
	    }
	   
	   setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
	    setVisible(true);
	  }
	
	public static void main(String[] args) {
		new JInternalFrames();
		
	}
	
}
